﻿/*
 * Last review by   : Yaser
 * Last review date : JUL-21-09
  */
using System;

namespace ERP.Business.DataTypes.Employee.Attendance
{
    /// <summary>
    /// Daily Working Hours Entry
    /// </summary>
    [System.Runtime.Serialization.DataContract]
    [Serializable]
    [System.Runtime.Serialization.KnownType(typeof(DailyWorkingHoursEntry))]
    public class DailyWorkingHoursEntry : BaseTypes.BaseType
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="DailyWorkingHoursEntry"/> class.
        /// </summary>
        public DailyWorkingHoursEntry() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="DailyWorkingHoursEntry"/> class.
        /// </summary>
        /// <param name="date">The date.</param>
        public DailyWorkingHoursEntry(DateTime date)
        {
            Date = date;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the date.
        /// </summary>
        /// <value>The date.</value>
        [System.Runtime.Serialization.DataMember]
        public DateTime Date
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the hours count.
        /// </summary>
        /// <value>The hours count.</value>
        [System.Runtime.Serialization.DataMember]
        public float HoursCount
        {
            get;
            set;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Compare objects
        /// </summary>
        /// <param name="x">object 1</param>
        /// <param name="y">object 2</param>
        /// <returns>Compare result</returns>
        public override int Compare(object x, object y)
        {
            if (ERP.Framework.Components.Utilities.ComparingHelper.ComapringManager.CompareTypes(x, y))
                return ((DailyWorkingHoursEntry)x).Date.CompareTo(((DailyWorkingHoursEntry)y).Date);
            return -1;
        }

        #endregion
    }
}